package com.rules.admin.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rules.admin.dao.UnitCaseParamDao;
import com.rules.admin.entity.UnitCaseParam;
import com.rules.admin.service.UnitCaseParamService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UnitCaseParamServiceImpl extends ServiceImpl<UnitCaseParamDao,UnitCaseParam> implements UnitCaseParamService {


   public List<UnitCaseParam> getAllParamByCaseId(Long unitCaseId) {
      LambdaQueryWrapper<UnitCaseParam> queryWrapper = new LambdaQueryWrapper<>();
      queryWrapper.ge(UnitCaseParam::getUnitCaseId, unitCaseId);
      queryWrapper.isNotNull(UnitCaseParam::getParentId);
      return this.baseMapper.selectList(queryWrapper);
   }

   public List<UnitCaseParam> getAllParamByParentId(Long parentId) {
      LambdaQueryWrapper<UnitCaseParam> queryWrapper = new LambdaQueryWrapper<>();
      queryWrapper.ge(UnitCaseParam::getParentId, parentId);
      return this.baseMapper.selectList(queryWrapper);
   }

   public List<UnitCaseParam> getParamByCaseId(Long unitCaseId) {
      LambdaQueryWrapper<UnitCaseParam> queryWrapper = new LambdaQueryWrapper<>();
      queryWrapper.ge(UnitCaseParam::getUnitCaseId, unitCaseId);
      return this.baseMapper.selectList(queryWrapper);
   }
}
